package com.yxq.mdt.app.modules.personal.adapter;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.yxq.mdt.app.R;
import com.yxq.mdt.app.modules.personal.bean.MainPersonalAuctionBean;
import com.yxq.mdt.app.modules.personal.bean.MainPersonalBean;

import java.util.List;

public class MainAuctionListAdapter extends BaseQuickAdapter<MainPersonalAuctionBean, BaseViewHolder> {

    public MainAuctionListAdapter(List<MainPersonalAuctionBean> data) {
        super(data);

    }

    @Override
    protected BaseViewHolder onCreateDefViewHolder(ViewGroup parent, int viewType) {
        //加载item 布局文件
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.personal_auction_item, parent, false);
        return new BaseViewHolder(view);
    }

    @Override
    protected void convert(BaseViewHolder helper, MainPersonalAuctionBean item) {
        ImageView icon = helper.getView(R.id.personal_item_img);
        icon.setImageResource(item.getImg());
        helper.setText(R.id.personal_item_text, item.getText());
        if (item.getSize() != 0) {
            helper.setGone(R.id.me_tv_unread_0, true);
            helper.setText(R.id.me_tv_unread_0, item.getSize()+"");
        } else {
            helper.setGone(R.id.me_tv_unread_0, false);
        }
    }
}
